<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function f() {
            var d=new Date();
            var hh=d.getHours();
            var mm=d.getMinutes();
            var ss=d.getSeconds();
             document.getElementById("myc").innerText="现在是："+hh+":"+mm+":"+ss;
          window.setTimeout("f()",10);
        }

    </script>
</head>
<body onload="f()">
<div id="myc"></div>
</body>
</html>